package com.vcredit.creditcat.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.vcredit.creditcat.model.ProductBusinessStatus;
import com.vcredit.creditcat.service.ProductBusinessStatusService;
import com.vcredit.creditcat.framework.pagination.Page;
 /*
  * @author liaoshengjun
  * @version 1.0
  * @since 1.0
 */
@RestController
@RequestMapping("/productBusinessStatus")
public class ProductBusinessStatusController extends BaseController {
    
    @Autowired
    private ProductBusinessStatusService productBusinessStatusService;
  
    @RequestMapping(value = "/list")
    public ModelAndView  showPageProductBusinessStatus(HttpServletRequest request) {
        return new ModelAndView("productbusinessstatus/productBusinessStatusList");
    }  
	
	@RequestMapping(value = "/listProductBusinessStatus", method = RequestMethod.GET)
	public Page<ProductBusinessStatus> findByPageProductBusinessStatus(HttpServletRequest request) {
      return productBusinessStatusService.findByPage(makeDefaultCriteria(request));
	}
	
	@RequestMapping(value = "/saveProductBusinessStatus", method = RequestMethod.POST)
	public String saveProductBusinessStatus(@RequestBody ProductBusinessStatus productBusinessStatus,HttpServletRequest request) {
	    productBusinessStatusService.save(productBusinessStatus);
		return SUCCESS;
	}
	   
    @RequestMapping(value = "/updateProductBusinessStatus", method = RequestMethod.PUT)
    public String updateProductBusinessStatus(@RequestBody ProductBusinessStatus productBusinessStatus,HttpServletRequest request) {
        productBusinessStatusService.update(productBusinessStatus);
        return SUCCESS;
    }
    
    @RequestMapping(value = "/removeProductBusinessStatus", method = RequestMethod.DELETE)
    public String removeProductBusinessStatus(@RequestParam("ids") String ids ,HttpServletRequest request) {
        productBusinessStatusService.removeProductBusinessStatus(ids);
        return SUCCESS;
    }	
}
